package lab4Source;

import java.util.ArrayList;

public class S_Iterator extends AbstractIterator {	
	ArrayList<AbstractShape> shapes;
	int index;
	
	
	public S_Iterator(Square root) {
		super();
		this.shapes = new ArrayList<AbstractShape>();
		root.getListOfShapes(this.shapes);
		this.first(); // just to make the new iterator nicer
	}

	@Override
	public void first() {
		this.index = 0;
	}

	@Override
	public void next() {
		this.index++;
	}

	@Override
	public boolean isDone() {
		return (this.index >= this.shapes.size());
	}

	@Override
	public AbstractShape currentItem() {
		return this.shapes.get(this.index);
	}

}
